package be.jprojects.subscription.gui.renderers;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;

public class HeaderRenderer extends JLabel implements TableCellRenderer {

	private Color selectedColor, color;
	private Font font;
	
	
	
	public HeaderRenderer() {
		 setOpaque(true); //MUST do this for background to show up.
		 color = new Color(249, 249, 249);
		 selectedColor = new Color(185, 199, 218);
		 font = new Font("Arial", Font.BOLD, 11);
	}

	
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		
		String stringValue = (String) value;
		this.setFont(font);
		if (isSelected) {
			this.setBackground(selectedColor);
		} else {
			this.setBackground(color);
		}
		this.setForeground(Color.BLACK);
		this.setText(stringValue);
		return this;
	}

}
